@using System.Text.RegularExpressions
@using ZKEACMS.Shop.Models
@model ZKEACMS.Shop.ViewModel.BasketData
@{
    Layout = null;
}
<div class="basket confirm-order">
    @using (Html.BeginForm("ConfirmOrder", "Basket"))
    {
        <input type="hidden" name="PaymentGateway" id="PaymentGateway" />
        <div class="basket-header clearfix">
            <div class="pull-left">
                <h4>@L("确认定单")</h4>
            </div>
            <button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        </div>
        <div class="basket-body">
            <div class="contact">
                <div class="form-group">
                    <label for="Contact">@L("联系人")</label>
                    <input type="text" class="form-control" id="Contact" name="Contact" placeholder="@L("联系人/收货人")" value="@ApplicationContext.CurrentCustomer.UserName">
                </div>
                <div class="form-group">
                    <label for="PhoneNumber">@L("电话")</label>
                    <input type="text" class="form-control" id="PhoneNumber" name="PhoneNumber" placeholder="@L("联系电话")" value="@(ApplicationContext.CurrentCustomer.MobilePhone??ApplicationContext.CurrentCustomer.Telephone)">
                </div>
                <div class="form-group">
                    <label for="ShippingAddress">@L("收货地址")</label>
                    <textarea class="form-control" rows="3" cols="10" name="ShippingAddress" id="ShippingAddress" placeholder="@L("详细的收货地址")">@ApplicationContext.CurrentCustomer.Address</textarea>
                </div>
            </div>
            <hr />
            <ul class="container-fluid">
                @if (Model.Basket != null)
                {
                    foreach (var item in Model.Basket)
                    {
                        <li id="basket-@item.ID" class="row" data-id="@item.ID">
                            <div class="col-xs-4">
                                <img src="@Url.PathContent(item.ImageUrl)" />
                            </div>
                            <div class="col-xs-8">
                                <h5>@item.Title</h5>
                                <div class="tag">
                                    @item.Description
                                </div>
                            </div>
                            <div class="clearfix"></div>
                            <div class="col-xs-4">
                                <div class="text-center quantity-set">
                                    <a href="javascript:" class="quantity-minus glyphicon glyphicon-minus-sign"></a>
                                    <span class="quantity">@item.Quantity</span>
                                    <a href="javascript:" class="quantity-plus glyphicon glyphicon-plus-sign"></a>
                                </div>
                            </div>
                            <div class="col-xs-8">
                                <div class="clearfix">
                                    <div class="text-right">
                                        <span class="price">
                                            ￥@Html.Raw(Regex.Replace(item.Price.ToString("F2"), @"\.(\d+)", "<small>.$1</small>"))
                                            x <span class="quantity">@item.Quantity</span>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </li>
                    }

                }
                @if (Model.Basket == null || !Model.Basket.Any())
                {
                    <li class="row empty text-center">
                        @L("您的购物车是空的")
                    </li>
                }
            </ul>
        </div>
        <div class="basket-footer">
            <div class="row total">
                <div class="col-xs-4">
                    <div class="text-center">
                        <span class="total-items">@Model.Quantity</span> @L("件")
                    </div>
                </div>
                <div class="col-xs-8">
                    <div class="clearfix">
                        <div class="text-right">
                            @L("总计")
                            <span class="price">
                                @L("￥")<span class="total-price">@Model.Total.ToString("F2")</span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <a class="confirm-order" data-payment="@ZKEACMS.Shop.Payment.Gateways.AliPay">
               @L("在线支付")
            </a>
        </div>
    }

</div>
